import Mock from 'mockjs'

Mock.setup({
  timeout: 500
})

Mock.mock(/\/user\/interest\.*/, 'get', config => {
  const result = []
  for (let i = 0; i < 9; i++) {
    result.push(Mock.mock({
      id: '@id',
      picture: 'https://yanxuan-item.nosdn.127.net/9be0f0c16d7fbafacee94ecc2d995ee8.jpg',
      name: '@ctitle(2,2)',
      selected: false
    }))
  }
  return {
    msg: '查询兴趣爱好成功',
    result
  }
})

Mock.mock(/\/user\/interest\.*/, 'post', config => {
  return {
    msg: '保存兴趣爱好成功',
    result: ''
  }
})

Mock.mock(/\/user\/size\.*/, 'get', config => {
  const result = []
  for (let i = 0; i < 5; i++) {
    const gender = Math.random() > 0.5 ? '男' : '女'
    const isDefault = Math.random() > 0.5
    result.push(Mock.mock({
      id: '@id',
      height: '@integer(100,200)',
      bodyWeight: '@integer(100,200)',
      shoulderWidth: '@integer(60,100)',
      chestCircumference: '@integer(60,100)',
      waistCircumference: '@integer(60,100)',
      hips: '@integer(60,100)',
      footSize: '@integer(30,60)',
      footCircumference: '@integer(30,60)',
      name: '@cname',
      gender,
      isDefault
    }))
  }
  return {
    msg: '查询我的尺码成功',
    result: result
  }
})

Mock.mock(/\/user\/size\.*/, 'post', config => {
  return {
    msg: '保存我的尺码成功',
    result: ''
  }
})
